﻿using Abp.AspNetCore;
using Abp.AspNetCore.Configuration;
using Abp.Modules;
using Abp.Reflection.Extensions;
using EasyCaching.Core;
using Hicap.QRCodeWarehouse.Application;
using Hicap.QRCodeWarehouse.Core;

namespace Hicap.QRCodeWarehouse.WebApi
{
    [DependsOn(
        typeof(QrCodeWarehouseApplicationModule),
        typeof(QrCodeWarehouseCoreModule),
        typeof(AbpAspNetCoreModule))]
    public class QrCodeWarehouseWebApiModule : AbpModule
    {
        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(typeof(QrCodeWarehouseWebApiModule).GetAssembly());
            IocManager.Register<IEasyCachingKeyGenerator, DefaultEasyCachingKeyGenerator>();
        }

        public override void PreInitialize()
        {
            Configuration.Modules.AbpAspNetCore()
                .CreateControllersForAppServices(
                    typeof(QrCodeWarehouseApplicationModule).GetAssembly()
                );
        }
    }
}